<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<f:view contentType="text/html;charset=UTF-8" encoding="UTF-8">
	<h:head>

	</h:head>

	<h:body>

		<h:form id="form">
			<h1>Toggleable</h1>
			<p:messages id="msgs" showDetail="true"
				skipDetailIfEqualsSummary="true" />

			<p:panel id="panel" header="Header" toggleable="true" closable="true"
				toggleSpeed="500" closeSpeed="500" widgetVar="panel">

				<p:ajax event="close" listener="#{panel001.onClose}" update="msgs" />
				<p:ajax event="toggle" listener="#{panel001.onToggle}"	update="msgs" />

				<p class="m-0">Lorem ipsum dolor sit amet, consectetur
					adipiscing elit, sed do eiusmod tempor incididunt ut labore et
					dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
					exercitation ullamco laboris nisi ut aliquip ex ea commodo
					consequat. Duis aute irure dolor in reprehenderit in voluptate
					velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
					occaecat cupidatat non proident, sunt in culpa qui officia deserunt
					mollit anim id est laborum.</p>

				<f:facet name="options">
					<p:menu>
						<p:submenu label="Settings">
							<p:menuitem value="Toggle" url="#" icon="pi pi-clone" onclick="PF('panel').toggle()" />
							<p:menuitem value="Remove" url="#" icon="pi pi-times" onclick="PF('panel').close()" />
						</p:submenu>
					</p:menu>
				</f:facet>
			</p:panel>
		</h:form>

	</h:body>
</f:view>

</html>